package string;

import java.util.Random;
import java.util.Scanner;

public class practice {
    public static void main(String[] args) {
        String m = asd(6);
        System.out.println(m);
        System.out.println("请输入验证码");
        Scanner shu = new Scanner(System.in);
        String a = shu.next();
        while (!a.equalsIgnoreCase(m)){
            System.out.println("请输入验证码");
            a = shu.next();
        }
    }
    public static String asd(int b1){
        char[] yzm = new char[]{'0','1','2','3','4','5','6','7','8','9','q','w','e','r','t','y'
                ,'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v'
                ,'b', 'n', 'm', 'Q', 'W', 'E', 'R', 'T', 'Y', 'U', 'I', 'O', 'P', 'A', 'S', 'D', 'F'
                ,'G', 'H', 'J', 'K', 'L', 'Z', 'X', 'C', 'V', 'B', 'N', 'M'};
        Random a = new Random();
        String a1 = "";
        for (int i = 0; i < b1; i++) {
            int b = a.nextInt(yzm.length);
            a1 +=yzm[b];
        }
        return a1;
    }

}